All Functions Used So Far, Week 7

geom_segment

{GGPLOT2}

Generates a line segment or curve

prop.test

{stats}

Test of Equal or Given Proportions

unique

{base}

get unique elements

freq

{questionr}

Generate frequency tables

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

filter

{dplyr}

Filter out rows of a data frame according to logical vector

levels

{base}

Get levels of a factor

t.test

{stats}

Performs one and two sample t-tests on vectors of data.

addmargins

{stats}

Puts Arbitrary Margins on Multidimensional Tables or Arrays

geom_density

{GGPLOT2}

Generates a density plot

nrow

{base}

Get number of rows of a data frame

names

{base}

Retrieve names of a list/vector

after_stat

{GGPLOT2}

Control aesthetic evaluation. On the module used for displying percent

desc

{dplyr}

Arrange in descending order

sample

{base}

Takes a sample of the specified size

tapply

{base}

Create statistical summaries by group based on the levels of one or several factors

boxplot

{graphics}

Plot a simple box plot

theme

{GGPLOT2}

Set theme for GGPLOT2

read_excel

{readxl}

Read an Excel file

read.spss

{foreign}

Read a .sav file (SPSS data)

as.factor

{base}

Coerce a vector to factor

cut

{base}

Convert Numeric to Factor

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

slice

{dplyr}

Subset rows using their positions

rm

{base}

Remove objects

rbeta

{stats}

Beta Random Number Generating Function

sample_n

{dplyr}

Sample a number of observations from a data frame

rbind

{base}

Combine R objects by rows

mutate

{dplyr}

Modify/create a column in a data frame

cbind

{base}

Combine R objects by columns

sd

{stats}

Get standard deviation of a vector

plot

{graphics}

Generic function from base R to produce a plot

hist

{graphics}

Plot a simple histogram

recode

{dplyr}

Recode a variable

class

{base}

Retrieve class of an R object

sum

{base}

Get sum of numeric values or a vector

element_text

{GGPLOT2}

Customise text in GGPLOT2

expression

{base}

Used in plots to add symbols to axes

labs

{GGPLOT2}

Customise labels in GGPLOT2

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

install.packages

{base}

Install R package

runif

{stats}

Draws ranndom numbers from the uniform distribution

xlab

{GGPLOT2}

Label the x axis (ggplot)

ifelse

{base}

Return a or b depending on the value of test

ggplot

{GGPLOT2}

Create a ggplot graph

ylab

{GGPLOT2}

Label the y axis (ggplot)

set.seed

{base}

Initialise a pseudorandom number generator.

ungroup

{dplyr}

Resolve grouping created with “group_by”

ls.str

{utils}

Similarly to ls, with a print() method that calls str() on each object

prop.table

{base}

Transform frequency table into table of proportions

geom_bar

{GGPLOT2}

Generates a bar chart

complete.cases

{stats}

Find Complete Cases

dnorm

{stats}

Density distribution for the normal distribution

lprop

{questionr}

Display row percentages of a two-way frequency table

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

rnorm

{base}

Generate random numbers from a normal distribution

attach

{base}

Attach Set of R Objects to Search Path

with

{base}

evaluate expression in the context of a data frame

geom_histogram

{GGPLOT2}

Generates a histogram

matrix

{base}

Creates a matrix from the given set of values.

barplot

{graphics}

Plot a simple bar plot

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

geom_point

{GGPLOT2}

Generates a scatter plot

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

summary

{base}

Obtain summary statistics or detailed regression output

ggtitle

{GGPLOT2}

Generates a title for a ggplot graph

tabulate

{base}

Counts the number of times each integer occurs in an integer-only vector

var

{stats}

Calculate variance

get_mode

{rstatix}

Compute the mode in a given vector.

library

{base}

Load an R package

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

as.numeric

{base}

Coerce a vector to numeric

min

{base}

Get minimum of a vector

mean

{base}

Get mean of a vector

par

{graphics}

Set parameters of the plotting device

grid.arrange

{gridExtra}

Places graphical objects into a rectangular grid

seq

{base}

Create a sequence

median

{stats}

Get median of a vector

setwd

{base}

Set Working Directory

bar

{base}

Used for annotations, such as “expression(paste(”-“,bar(y)))”

cor.test

{stats}

Test for Association/Correlation Between Paired Samples

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

which

{base}

return indexes of TRUE entries of a logical vector

View

{base}

View a data frame

range

{base}

Return range of values

as.data.frame

{base}

Functions to check if an object is a data frame, or coerce it if possible.

data.frame

{base}

Create a data.frame from vectors

element_blank

{GGPLOT2}

This theme element draws nothing, and assigns no space

arrow

{GGPLOT2}

Draw an arrow in a ggplot graph

c

{base}

Combine values/vectors into a vector

order

{base}

Get indexes that will sort a vector

str

{utils}

Get the structure of an R object

ncol

{base}

Get number of columns of a data frame

geom_ribbon

{GGPLOT2}

Generates an area plot

which.max

{base}

return index of the largest value in a vector

pie

{graphics}

Creates a basic pie chart

select

{dplyr}

Select columns from a tibble/data frame

ordered

{dplyr}

Create an ordered factor

head

{utils}

Show first 5 rows of a data frame

chisq.test

{stats}

Chi-Squared test (e.g. for cross-tabulations)

dim

{base}

Get dimensions of a data frame

round

{base}

Rounds numbers

max

{base}

Get maximum of a vector

theme_bw

{GGPLOT2}

A black and white ggplot theme

cor

{stats}

Calculate Correlation Matrix

is.na

{base}

Check if a value is NA/elements of vector are NA

factor

{base}

Create a factor

The end!